package pro.cherish.helloworld.client;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

/**
 * @author 创建人：lys
 * @version 版本号：V1.0
 * <p>
 * ***************************修订记录************************************
 * 2020-6-15 lys 创建该类功能。
 * **********************************************************************
 * </p>
 * @ClassName 类名：ClientInitializer
 * @Description 功能说明：
 * <p>
 * TODO
 * </p>
 * **********************************************************************
 * @date 创建日期： 2020-6-15 
 */
public class ClientInitializer extends ChannelInitializer<SocketChannel> {
	private static final StringEncoder ENCODER = new StringEncoder();
	private static final StringDecoder DECODER = new StringDecoder();
	private static final ClientHandler clientHandler = new ClientHandler();


	@Override
	protected void initChannel(SocketChannel socketChannel) throws Exception {
		ChannelPipeline pipeline = socketChannel.pipeline();
		pipeline.addLast(DECODER).addLast(ENCODER).addLast(clientHandler);
	}
}
